


#ifndef _OFFLINE_PARAM_H_
#define _OFFLINE_PARAM_H_


#include "stdint.h"
#include "tof050f.h"


#define  NUM_OFFLINE_PARAM       60

#define  PARAM_INFO_START_ADDR   0x0803E000
#define  PARAM_APP_START_ADDR    0x0803E800

#define  PARAM_BOOT_ACK_ADDR     0x0807F800


#define  PASSWORD_ADDR           (PARAM_APP_START_ADDR + 0)
#define  PASSWORD_DEFAULT        1234

#define  PARAM_VER_NUM_ADDR      (PARAM_APP_START_ADDR + 8)

#define  PARAM_DEVICE_TYPE_ADDR  (PARAM_APP_START_ADDR + 4)
#define  PARAM_DEVICE_NUM_ADDR   (PARAM_APP_START_ADDR + 6)




typedef enum
{
	ENUM_CLEAN_ROBOT = 0,
	ENUM_SERVICE_ROBOT  = 1,
	ENUM_ROBOT = 2

}ENUM_DEVICE_TYPE;






typedef union
{
	struct
	{
		uint16_t password_L;
		uint16_t password_H;
		uint16_t device_type;
		uint16_t device_num;
		uint16_t verNum_param;
		
		uint16_t reserve[13];
		
		
		uint16_t comm_ot_ms;
		uint16_t comm_exe_type;
		uint16_t bat_comm_ot_ms;
		uint16_t clean_comm_ot_ms;
		
		
		uint16_t thred_reserve[21];
		
		uint16_t cliff_threshold[TOF_DEVICE_ALL];

	};
	
	uint16_t data[NUM_OFFLINE_PARAM];

}STR_OFF_PARAM;



extern STR_OFF_PARAM  AppParamHdl;

extern void flash_param_init(void);
extern uint8_t flash_param_cache_write(uint16_t addr, uint16_t data);
extern uint8_t flash_param_saveALL(void);

#endif


